package leetcode;

import java.util.Arrays;

/**
 * @Project : AlgorithmLearning
 * @Package : Leetcode
 * @File : Q0283.java
 * @Author : WangRuoyu
 * @Date 2023/9/5 15:41
 */

public class Q0283 {
    public void moveZeroes(int[] nums) {
        int k = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] != 0) nums[k++] = nums[i];
        }
        for (int i = k; i < nums.length; i++) {
            nums[i] = 0;
        }
        System.out.println(Arrays.toString(nums));
    }

    public static void main(String[] args) {
        Q0283 sl = new Q0283();
        int[] nums = {0, 1, 0, 3, 12};
        sl.moveZeroes(nums);
    }
}